from django.db import models

# 店铺表
class ShopTab(models.Model):
    name = models.CharField(max_length=200, verbose_name="店铺名")
    sku = models.IntegerField(verbose_name="sku", default=0)
    sales = models.IntegerField(verbose_name="销量", default=0)

    class Meta:
        verbose_name_plural = "店铺"

    def __str__(self):
        return self.name


# 子门店
class ProductTab(models.Model):
    shop = models.ForeignKey(ShopTab, verbose_name="店铺", on_delete=models.CASCADE)
    price = models.FloatField(verbose_name="价格")
    model = models.CharField(max_length=255, verbose_name="型号")
    size = models.CharField(max_length=20, verbose_name="尺码")
    sales = models.IntegerField(verbose_name="销量", default=0)
    product = models.CharField(max_length=255, verbose_name="产品链接")
    evaluate = models.IntegerField(verbose_name="评价", default=0)

    class Meta:
        verbose_name_plural = "产品"

    def __str__(self):
        return self.model